package com.springboot.jeesite.common.queue.activemq;

import com.springboot.jeesite.common.utils.SpringContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * CompanyRestController.java
 *
 * @author xxx
 * @version xxx
 */
@RestController
@RequestMapping(value = "${adminPath}/mq/producer")
public class CompanyRestController {
    //http://localhost:8080/admin/mq/producer/sendMessage
    @RequestMapping(value = {"sendMessage"})
    public void sendMessage(@RequestParam(required = false) String message) {
        CompanyProducer companyProducer = SpringContextHolder.getBean("companyProducer");
        for (int i = 0; i < 1000; i++) {
            companyProducer.sendMessage("test" + i);
            System.out.println("send message:test" + i);
        }
        for (int i = 0; i < 1000; i++) {
            companyProducer.consumerMessage("consumer" + i);
            System.out.println("send message:consumer" + i);
        }
    }
}
